#define _CRT_SECURE_NO_WARNINGS 1

#include<iostream>
using namespace std;

//template<class T>
//void Swap(T& x, T& y)
//{
//	T temp = x;
//	x = y;
//	y = temp;
//}
//
//void Swap(int& x, int& y)
//{
//	int temp = x;
//	x = y;
//	y = temp;
//}

//template<class T,class Y>
//T Add(const T& x,const Y& y)
//{
//	return x + y;
//}

template<class T>
class A
{
public:
	A(int n =4)
	{
		_a = new T[n];
		_top = 0;
		_capacity = n;
	}

	void push(T x)
	{
		_a[_top++] = x;
	}

	~A();
	/*{
		delete[] _a;
		_a = nullptr;
		_top = _capacity = 0;
	}*/

private:
	T* _a;
	int _top;
	int _capacity;
};

template<class T>
A<T>::~A()
{
	delete[] _a;
	_a = nullptr;
	_top = _capacity = 0;
}

int main()
{
	A<int> a(4);
	A<double> a1(4);
	a1.push(2.3);
	a.push(45);
	/*int a = 2;
	int b = 3;
	double a1 = 2.2;
	double b1 = 3.3;*/
	/*cout << Add(a , b) << endl;
	cout << Add(a1, b1) << endl;*/
	/*cout << Add((int)a1, a) << endl;
	cout << Add(a1 ,(double)a) << endl;*/

	/*cout << Add(a1, b) << endl;
	cout << Add(b1,a)<<endl;*/
	/*int x = 10;
	int y = 12;
	Swap(x, y);
	cout << x << " " << y << endl;

	double x1 = 11.22;
	double y2 = 12.22;
	Swap((int)x1, (int)y2);
	cout << x1 << " " << y2 << endl;*/
	
	return 0;
}